const autoprefixer = require('autoprefixer')
const cssnano = require('cssnano')
const createDir = require('./createDir');

module.exports = function (input,output) {

    fs.readFile(input,"utf-8",(err,data)=>{
        createDir(output + path.basename(input))
        postcss([ autoprefixer,cssnano ]).process(data).then(css => {
            fs.writeFile(output + path.basename(input), css, err => {
                if (err) throw err;
                else {
                    console.log('--'+output + path.basename(input)+'--')
                }
            });
        })
    })




}